import request from '@/utils/request.js'
//首页的小仓库
const state = {
	homeData:{},
	otherData:[]
};
const mutations = {
	GETHOMEDATA(state,homeData){
		state.homeData = homeData;
	},
	GETOTHER(state,otherData){
		state.otherData = otherData;
	}
};
const actions = {
	async getHomeData({commit}) {
		let result = await request("/getIndexData");
		console.log(result);
		commit('GETHOMEDATA', result);
	},
	async getOther({commit}){
		let result = await request("/getIndexCateList");
		commit('GETOTHER',result);
	}
};
const getters = {
	goodList(state){
		return (state.homeData.kingKongModule||{}).kingKongList||[]
	},
	iconList(state){
		return state.homeData.policyDescList||[]
	},
	cardData(state){
		return state.homeData.categoryModule||[]
	}
};
export default {
	state,
	mutations,
	actions,
	getters
}
